home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_400
/
436_01
/
indefs.h
< prev
next >
Wrap
Text File
|
1994-10-07
|
10KB
|
290 lines
/*************************************************************************
Header file: INDEFS.H
Contains directives, definitions, and macros used by INCON.LIB.
Compiler: Borland Turbo C 2.01
INCON source files and the object and library files created from
them are:
Copyright (c) 1993-94, Richard Zigler.
You may freely distribute unmodified source, object, and library
files, and incorporate them into your own non-commercial software,
provided that this paragraph and the program name and copyright
strings defined in INCON.C are included in all copies.
*************************************************************************/
#if !defined(IN_DEFS)
#define IN_DEFS
/**** Model-dependent Pointer Types ****/
#if defined( __TINY__ ) || defined( __SMALL__ ) || defined( __MEDIUM__ )
typedef char near * pCHAR;
#else
typedef char far * pCHAR;
#endif
/**** Data Type Synonyms ****/
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef short FLAG; /* int-size true/false flag */
typedef char BFLAG; /* byte-size true/false flag */
#define NO 0
#define YES 1
/**** Keyboard Macros ****/
#define KEYREAD (bioskey(0)) /* read keyboard buffer */
#define KEYREADY (bioskey(1)) /* check for key in buffer */
#define KEYSTATUS (bioskey(2)) /* get k/b shift key flags */
/**** Shift Key Masks ****/
#define R_SHIFT 0x01 /* [Right Shift] down */
#define L_SHIFT 0x02 /* [Left Shift] down */
#define CTRL_KEY 0x04 /* [Ctrl] down */
#define ALT_KEY 0x08 /* [Alt] down */
#define SCR_LOCK 0x10 /* [Scroll Lock] on */
#define NUM_LOCK 0x20 /* [Num Lock] on */
#define CAP_LOCK 0x40 /* [Caps Lock] on */
#define INS_MODE 0x80 /* [Ins] mode active */
/**** BIOS Video Services ****/
#define GET_ATTR 0x08 /* reads char/attr at cursor */
#define WRITE_MANY 0x09 /* write char/attr n times */
#define BIOS_VIDEO 0x10
/**** BIOS Cursor Services ****/
#define ACT_PAGE 0x00 /* active video page */
#define CUR_SIZE 0x01 /* set cursor size */
#define CUR_SET 0x02 /* set cursor position */
#define CUR_GET 0x03 /* read cursor type/position */
#define CUR_OFF 0x2000 /* turn off cursor */
/**** Switches for Cursor() ****/
static enum CurSwitch /* cursor switch */
{
OFF , /* switch off */
ON , /* switch on */
SAVE , /* save location */
RESTORE , /* restore to location */
} ;
/**** Maximum Video Mode 3 Columns *****/
#define MAXCOL 80
/**** Input Field Delimiters ****/
#define L_DELIM '[' /* normal delimiter, left */
#define R_DELIM ']' /* normal delimiter, right */
#define L_CONT '<' /* continuation delimiter, left */
#define R_CONT '>' /* continuation delimiter, right */
/**** Do NOT remove the curls from around ERROR_BEEP, you idiot!!! ****/
#define ERROR_BEEP { sound(698) ; delay(80) ; nosound() ; }
/**** Data Macros ****/
#define LOBYTE(x) ((x) & 0x00FF) /* get low byte of int */
#define HIBYTE(x) ((x) & 0xFF00) /* get high byte of int */
#if !defined(INCON_BUFFER)
#define INCON_BUFFER 255 /* default buffer size */
#endif
/**** InCon Edit Keys ****/
/* Do not include these */
/* keys in the extended- */
/* key list. */
/*************************/
/**** Cursor Movement ****/
#define HOME 0x47 /* [Home]: start of input field */
#define LEFT 0x4B /* [LeftArrow]: character left */
#define RIGHT 0x4D /* [RightArrow]: character right */
#define END 0x4F /* [End]: end of input field */
#define C_LEFT 0x73 /* [^LeftArrow]: word left */
#define C_RIGHT 0x74 /* [^RightArrow]: word right */
/**** Character Deletion ****/
#define C_L 0x0C /* [^L]: word left */
#define C_R 0x12 /* [^R]: word right */
#define C_END 0x75 /* [^End]: to end of field */
#define C_HOME 0x77 /* [^Home]: to start of field */
#define DEL 0x53 /* [Del]: character at cursor */
#define BS 0x08 /* [BackSpace]: character left */
/**** Other Edit Keys ****/
#define K_MINUS 0x4A /* [Keypad -] */
#define K_PLUS 0x4E /* [Keypad +] */
#define CR 0x0D /* [Enter]: end of input */
#define ESC 0x1B /* [Esc]: clear input field */
/**** Special-case Extended Key (see INCON.DOC) ****/
#define TAB 0x09
/****
Bit field and union declarations for flags. See the file INCON.DOC
for a discussion of the action of each flag.
****/
typedef struct
{
unsigned Template : 1; /* treat default as template */
unsigned Hide : 1; /* do not echo input */
unsigned Scroll : 1; /* scroll field */
unsigned xKeys : 1; /* trap extended keys */
unsigned Delimit : 1; /* display field delimiters */
unsigned Confirm : 1; /* confirm input */
unsigned Display : 1; /* display template */
unsigned Sign : 1; /* allow sign */
unsigned Message : 1; /* enable run-time messages */
unsigned Strip : 1; /* strip template delimiters */
unsigned Justify : 2; /* field justification */
unsigned Type : 3; /* input type */
unsigned Debug : 1; /* display stats */
} BIT_FLAGS;
typedef union
{
WORD iflags ; /* address flags as integer */
BIT_FLAGS bflags ; /* address flags as bit-field */
} FLAGS ;
/****
Structure and union declarations for message block. See the file
INCON.DOC for a discussion of program parameters.
****/
typedef struct
{
WORD BufOff ; /* input/output buffer offset */
WORD BufSeg ; /* input/output buffer segment */
WORD KeyOff ; /* extended-key list offset */
WORD KeySeg ; /* extended-key list segment */
FLAGS Flags ; /* flags union defined above */
BYTE Width ; /* field maximum width */
BYTE Prec ; /* field minimum entry/decimals */
BYTE Visible ; /* scrolling field visible len */
BYTE Attr ; /* field video attribute */
BYTE Fill ; /* field fill character */
BYTE Pad ; /* pad for justified/numeric */
} SBLOCK ;
typedef union
{ /* address message block as: */
WORD iblock[8]; /* integer array */
SBLOCK sblock ; /* structure */
} MBLOCK ;
/**** Flag Values ****/
#define FLAG_TEMPLATE 0x0001
#define FLAG_HIDE 0x0002
#define FLAG_SCROLL 0x0004
#define FLAG_XKEYS 0x0008
#define FLAG_DELIMIT 0x0010
#define FLAG_CONFIRM 0x0020
#define FLAG_DISPLAY 0x0040
#define FLAG_SIGN 0x0080
#define FLAG_MESSAGE 0x0100
#define FLAG_STRIP 0x0200
#define FLAG_NJUST 0x0000
#define FLAG_LJUST 0x0400
#define FLAG_CJUST 0x0800
#define FLAG_RJUST 0x0C00
#define FLAG_ALPHA 0x0000
#define FLAG_UPPER 0x1000
#define FLAG_INTGR 0x2000
#define FLAG_FLOAT 0x3000
#define FLAG_MIXED 0x4000
#define FLAG_DEBUG 0x8000
/**** Flag Masks ****/
#define MASK_TEMPLATE 0x0001
#define MASK_HIDE 0x0002
#define MASK_SCROLL 0x0004
#define MASK_XKEYS 0x0008
#define MASK_DELIMIT 0x0010
#define MASK_CONFIRM 0x0020
#define MASK_DISPLAY 0x0040
#define MASK_SIGN 0x0080
#define MASK_MESSAGE 0x0100
#define MASK_STRIP 0x0200
#define MASK_JUSTIFY 0x0C00
#define MASK_TYPE 0x7000
#define MASK_DEBUG 0x8000
/**** Flag Shifts ****/
#define SHIFT_TEMPLATE 0
#define SHIFT_HIDE 1
#define SHIFT_SCROLL 2
#define SHIFT_XKEYS 3
#define SHIFT_DELIMIT 4
#define SHIFT_CONFIRM 5
#define SHIFT_DISPLAY 6
#define SHIFT_SIGN 7
#define SHIFT_MESSAGE 8
#define SHIFT_STRIP 9
#define SHIFT_JUSTIFY 10
#define SHIFT_TYPE 12
#define SHIFT_DEBUG 15
/****
Numeric values for multi-bit flags. These values may be
combined with the masks and shifts to set individual flags.
****/
#define NJUST 0 /* no justify